﻿<%@ WebHandler Language="C#" Class="IndexHandler" %>

using System;
using System.Web;

public class IndexHandler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        string action = context.Request["action"];
        string stdid = context.Request["stdid"];
        string techid = context.Request["techid"];
        string yterm = context.Request["term"];
        string data_back = "";
        switch (action)
        {
            case "getCoursesByStdTerm":
                CourseSearch courSearch = new CourseSearch();
                data_back = courSearch.getCoursesByStdTerm(stdid, yterm);
                break;
            case "getCoursesByTechTerm":
                courSearch = new CourseSearch();
                data_back = courSearch.getCoursesByTechTerm(techid, yterm);
                break;
        }

        context.Response.Write(data_back);
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }

}